package com.jia.lidao.others.ui;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;

import com.jia.lidao.R;
import com.jia.lidao.others.LoaderContentFragmentActivity;
import com.jia.lidao.others.ui.fragment.MyOrderFragment;
import com.jia.lidao.ui.BaseActivity;
import com.jia.lidao.ui.personal.ContentFragment;
import com.jia.lidao.ui.personal.adapter.TabAdapter;
import com.jia.lidao.widget.CommonTitleBar;

import java.util.ArrayList;
import java.util.List;

public class MyOrderActivity extends BaseActivity {


    /**
     * Created by jia on 17/12/18.
     */

    private TabLayout tabLayout;

    private ViewPager viewPager;

    private TabAdapter adapter;

    private List<Fragment> fragments;

    private CommonTitleBar titleBar;


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_orderlist2);
        tabLayout = (TabLayout) findViewById(R.id.tab_essence);
        viewPager = (ViewPager) findViewById(R.id.fr_viewpager);
        initView();
        initData();
    }


    private void initView() {
        fragments = new ArrayList<>();
        //status：-2已关闭 -1已驳回 1待付款 2待审核 3待发货 4待收货 5待评价 6已完成 ,
        final String[] titles = getResources().getStringArray(R.array.order_tab3);
        fragments.add(ContentFragment.newInstance(0, 0));
        fragments.add(ContentFragment.newInstance(0, 1));
        fragments.add(ContentFragment.newInstance(0, 2));
        fragments.add(ContentFragment.newInstance(0, 3));
        fragments.add(ContentFragment.newInstance(0, 4));
        fragments.add(ContentFragment.newInstance(0, 5));

        adapter = new TabAdapter(getSupportFragmentManager(), fragments, titles);
        viewPager.setAdapter(adapter);
        viewPager.setCurrentItem(0);
        viewPager.setOffscreenPageLimit(5);
        tabLayout.setupWithViewPager(viewPager);
        titleBar = (CommonTitleBar) findViewById(R.id.common_title_bar);
        titleBar.setTitle("订货列表");
    }


    private void initData() {
    }
}

